// ActionScript file
package mars.display
{
	import mx.controls.Image;
	//边框颜色
	[Style(name="borderColor", type="uint", format="Color", inherit="no")]
	//边框宽度
	[Style(name="borderWidth", type="Number", format="Length", inherit="no")]
	//边框透明度
	[Style(name="borderAlpha", type="Number", format="Length", inherit="no")]
	
	public class BorderImage extends Image
	{
		public function BorderImage()
		{
			super();
		}
	
		override protected function updateDisplayList(w:Number, h:Number):void{
			super.updateDisplayList(w,h);
			graphics.clear();
			
			graphics.lineStyle(getStyle('borderWidth'),getStyle('borderColor'),getStyle('borderAlpha'),false);
		
			var x:Number=-(getStyle('borderWidth')/2);
			var y:Number=-(getStyle('borderWidth')/2);
			var width:Number=contentWidth+getStyle('borderWidth');
			var height:Number=contentHeight+getStyle('borderWidth');
			graphics.drawRect(x,y,width,height);		
		}
	}
}